import numpy as np

def initialization(SearchAgents_no, Dim, UB, LB):
    X = np.zeros((SearchAgents_no, Dim))
    UB = np.array(UB)
    LB = np.array(LB)
    if UB.size == 1:
        X = np.random.rand(SearchAgents_no, Dim) * (UB - LB) + LB
    else:
        for i in range(Dim):
            X[:, i] = np.random.rand(SearchAgents_no) * (UB[i] - LB[i]) + LB[i]
    return X
